import http from '/@lib/utils/http/request'
import { DictDataForm, DictDataVO } from '/@/api/system/dict/data/types.ts'

export const DictDataApi: any = {};

// 根据字典类型查询字典数据信息
DictDataApi.getDictDataByType = (dictType: string): Promise<DictDataVO[]> => {
  return http.get("/system/dict/data/type/" + dictType);
};

// 根据字典类型查询字典数据信息
DictDataApi.pageByType = (dictType: string): Promise<PageResult<DictDataVO[]>> => {
  return http.get("/system/dict/data/page/" + dictType);
};

// 查询字典明细详细
DictDataApi.getInfo = (dictId: number | string): Promise<DictDataVO> => {
  return http.get("/system/dict/data/getInfo" + dictId);
};

// 新增字典明细
DictDataApi.add = (data: DictDataForm) => {
  return http.post("/system/dict/data/add", data);
};

// 修改字典明细
DictDataApi.update = (data: DictDataForm) => {
  return http.post("/system/dict/data/update", data);
};

// 删除字典明细
DictDataApi.delete = (id: string | number | Array<string | number>) => {
  return http.post("/system/dict/data/delete/" + id);
};
